#computes statistics. see statistics.csv
"compute.statistics" = function(sim.values, statistics.select){
Para = read.csv("Data/statistics.csv");
	statistics.object.vector = NULL
	for(k in 1:(length(Para$Statistic.Selection.Index))){
     	  if (Para$Statistic.Selection.Index[k] == statistics.select) i = k;
    	}

	
	for(k in 2:length(names(Para))){
		#decode the statistic name here and compute the appropriate statistic(s) based
		#on the supplied parameters e.g. lag
		statistic.name = as.character(names(Para)[k])
		if(as.character(Para[i,k]) != "n"){	
			statistic.parameters = as.matrix(as.numeric(unlist(strsplit(as.character(Para[i,k]),","))));
			if (statistic.name == "QDR"){
				statistics.object.vector = c(statistics.object.vector,get.QDR(sim.values,statistic.parameters));				
			}

			if (statistic.name == "QML"){
				statistics.object.temp = LiMcLeod(sim.values,statistic.parameters)
				statistics.object.temp2 = structure(list(name = statistic.name,STATISTIC = statistics.object.temp[,2],lags=statistics.object.temp[,1],PVAL=statistics.object.temp[,4],df=statistics.object.temp[,3]));
				statistics.object.vector=c(statistics.object.vector,statistics.object.temp2);
			}
			if (statistic.name == "QLB"){
				statistics.object.temp = LjungBox(sim.values,statistic.parameters)
				statistics.object.temp2 = structure(list(name = statistic.name,STATISTIC = statistics.object.temp[,2],lags=statistics.object.temp[,1],PVAL=statistics.object.temp[,4],df=statistics.object.temp[,3]));
				statistics.object.vector=c(statistics.object.vector,statistics.object.temp2);
			}
			if (statistic.name == "QSR"){
				statistics.object.vector = c(statistics.object.vector,get.QSR(sim.values,statistic.parameters));				
			}


		}
	}

	   return(structure(list(statistics.object.vector = statistics.object.vector)));

}